package cn.itsource.ymcc.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.stereotype.Component;


import java.math.BigDecimal;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Component
@Document(indexName="course",type = "course")
public class CourseDocumentDto {

    @Id
    private Long id;

    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer ="ik_max_word" )
    //课程名称
    private String name;

    // 适用人群
    @Field(type = FieldType.Keyword)
    private String forUser;

    // 课程分类
    @Field(type = FieldType.Long)
    private Long courseTypeId;

    // 课程分类
    @Field(type = FieldType.Keyword)
    private String courseTypeName;

    // 课程等级
    @Field(type = FieldType.Long)
    private Long gradeId;

    // 课程等级
    @Field(type = FieldType.Keyword)
    private String gradeName;

    // 封面，云存储地址
    @Field(type = FieldType.Keyword)
    private String pic;

    // 简介
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer ="ik_max_word" )
    private String intro;

    @Field(type = FieldType.Date)
    private Date startTime;
    @Field(type = FieldType.Date)
    private Date endTime;
    @Field(type = FieldType.Date)
    private Date onlineTime;  // 上架时间

    // 收费规则：，收费1免费，2收费
    @Field(type = FieldType.Integer)
    private Integer charge;

    // 价格
    @Field(type = FieldType.Double)
    private BigDecimal price;

    // 原价
    @Field(type = FieldType.Double)
    private BigDecimal priceOld;

    // 讲师，逗号分隔多个
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer ="ik_max_word" )
    private String teacherNames;

    // 销量
    @Field(type = FieldType.Integer)
    private Integer saleCount;

    // 浏览量
    @Field(type = FieldType.Integer)
    private Integer viewCount;

    // 评论数
    @Field(type = FieldType.Integer)
    private Integer commentCount;

}
